<?php
$jsontext = "[";
foreach ($toGraph as $key => $value) {
    $jsontext .= "{\"" . $value['datum'] . "\":{ \"v\": " . (int)($value['pocet']) . "}},";
}
$jsontext = substr_replace($jsontext, '', -1); // ciarku
$jsontext .= "]";
echo $jsontext;
?>